using AutojsController.Helpers;
using AutojsController.ViewModels;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Notifications;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using SukiUI.Toasts;

namespace AutojsController.Views;

public partial class AddMobileDialogView : UserControl
{
    public AddMobileDialogView()
    {
        InitializeComponent();
    }

    private void AddButton_Click(object? sender, RoutedEventArgs e)
    {
        if (!AddIPTextBox.IsValidIPAddress())
        {
            var toastManager = (Application.Current as App)!.GetRequiredService<ISukiToastManager>();
            SukiToast.Error(toastManager, "指定IP地址无效");
            AddIPTextBox.Focus(0);
            e.Handled = true;
            return;
        }
    }
}